package com.xiangyun.xyojbackenduserservice.controller.innner;

import com.xiangyun.xyojbackendmodel.entity.User;
import com.xiangyun.xyojbackendserviceclient.service.UserFeignClient;
import com.xiangyun.xyojbackenduserservice.service.UserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.Collection;
import java.util.List;

/**
 * 该服务只是内部调用的，不是给前端的
 */
@RestController
@RequestMapping("/inner")
public class UserInnerController implements UserFeignClient {

    @Autowired
    private UserService userService;
    @Override
    @GetMapping("/get/id")
    public User getById(@RequestParam("id") Long id) {
        return userService.getById(id);
    }

    @Override
    @GetMapping("/get/ids")
    public List<User> listByIds(@RequestParam("idList") Collection<Long> idList) {
        return userService.listByIds(idList);
    }

    @Override
    @PostMapping("/post/id")
    public boolean updateById(@RequestBody User user) {
        return userService.updateById(user);
    }


}
